package com.tale.init;

import com.blade.ioc.annotation.Inject;
import com.tale.service.SiteService;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimerTask;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * Created by Administrator on 2017/3/30 0030.
 */
public class TimingTask {

    static int count = 0;

    static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");

    public static void run(){
        ScheduledExecutorService pool = Executors.newScheduledThreadPool(3);
        System.out.println("开始" + sdf.format(new Date()));
        pool.scheduleAtFixedRate(new TimerTask() {
            @Override
            public void run() {

                System.out.println(sdf.format(new Date()) + " A: do task");
            }
        }, 5, 5, TimeUnit.SECONDS);
    }
}
